package com.lyfx.ly.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.lyfx.ly.entity.ClassCourseEstypeEntity;
import com.lyfx.ly.service.ClassCourseEstypeService;
import com.lyfx.common.utils.PageUtils;
import com.lyfx.common.utils.R;



/**
 * 
 *
 * @author lsy
 * @email lsy@gmail.com
 * @date 2020-07-24 20:47:07
 */
@RestController
@RequestMapping("ly/classcourseestype")
public class ClassCourseEstypeController {
    @Autowired
    private ClassCourseEstypeService classCourseEstypeService;


    //ly/classcourseestype/8/up
    @PostMapping("/{courseId}/up")
    public R classUp(@PathVariable("courseId")Long courseId ){
        classCourseEstypeService.up(courseId);
        return R.ok();
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("ly:classcourseestype:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = classCourseEstypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("ly:classcourseestype:info")
    public R info(@PathVariable("id") Long id){
		ClassCourseEstypeEntity classCourseEstype = classCourseEstypeService.getById(id);

        return R.ok().put("classCourseEstype", classCourseEstype);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("ly:classcourseestype:save")
    public R save(@RequestBody ClassCourseEstypeEntity classCourseEstype){
		classCourseEstypeService.save(classCourseEstype);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("ly:classcourseestype:update")
    public R update(@RequestBody ClassCourseEstypeEntity classCourseEstype){
		classCourseEstypeService.updateById(classCourseEstype);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("ly:classcourseestype:delete")
    public R delete(@RequestBody Long[] ids){
		classCourseEstypeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
